From f900ac3343f4bb09798ca70cf55c674fc586d946 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Mon, 23 May 2005 10:17:35 +0000 Subject: [PATCH] bitkeeper revision 1.1510 (4291adbf-g-WMA-w33q-SnHuwoX3BA) XendDomain.py, xc_linux_save.c: Re-arrange layout of save/restore file. Signed-off-by: Christian Limpach --- tools/libxc/xc_linux_save.c | 9 ++++++--- tools/python/xen/xend/XendDomain.py | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c index 7c7415e831..8273f9c56c 100644 --- a/tools/libxc/xc_linux_save.c +++ b/tools/libxc/xc_linux_save.c @@ -638,9 +638,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) /* Start writing out the saved-domain record. */ - if ( xcio_write(ioctxt, "LinuxGuestRecord", 16) || - xcio_write(ioctxt, &nr_pfns, sizeof(unsigned long)) || - xcio_write(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ){ + if ( xcio_write(ioctxt, "LinuxGuestRecord", 16) ){ xcio_error(ioctxt, "Error writing header"); goto out; } @@ -648,6 +646,11 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) xcio_error(ioctxt, "Error writing vmconfig"); goto out; } + if ( xcio_write(ioctxt, &nr_pfns, sizeof(unsigned long)) || + xcio_write(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ){ + xcio_error(ioctxt, "Error writing header"); + goto out; + } print_stats( xc_handle, domid, 0, &stats, 0 ); diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 91ae01f85a..8f2a03b14f 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -342,16 +342,6 @@ class XendDomain: raise XendError("not a valid guest state file: found '%s'" % signature) - l = fd.read_exact(sizeof_unsigned_long, - "not a valid guest state file: pfn count read") - nr_pfns = unpack("=L", l)[0] # XXX endianess - if nr_pfns > 1024*1024: # XXX - raise XendError( - "not a valid guest state file: pfn count out of range") - - pfn_to_mfn_frame_list = fd.read_exact(PAGE_SIZE, - "not a valid guest state file: pfn_to_mfn_frame_list read") - l = fd.read_exact(sizeof_int, "not a valid guest state file: config size read") vmconfig_size = unpack("i", l)[0] # XXX endianess @@ -366,6 +356,16 @@ class XendDomain: vmconfig = p.get_val() dominfo = self.domain_configure(vmconfig) + l = fd.read_exact(sizeof_unsigned_long, + "not a valid guest state file: pfn count read") + nr_pfns = unpack("=L", l)[0] # XXX endianess + if nr_pfns > 1024*1024: # XXX + raise XendError( + "not a valid guest state file: pfn count out of range") + + pfn_to_mfn_frame_list = fd.read_exact(PAGE_SIZE, + "not a valid guest state file: pfn_to_mfn_frame_list read") + # XXXcl hack: fd.tell will sync up the object and # underlying file descriptor ignore = fd.tell() -- 2.30.2